package com.extension.company.common.widget.dialog;

import android.app.Dialog;
import android.content.Context;
import android.content.DialogInterface;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;

import com.extension.company.admin.R;

/**
 * 作者:zwk
 * 联系方式：497981239@qq.com
 * 时间：on 2019/7/25 21:13
 * 功能：加载等待对话框
 */
public class LoadingDialog extends Dialog {

	private Context mContext;

	public LoadingDialog(Context context) {
		this(context, R.style.dialog_loading);
	}

	public LoadingDialog(Context context, int themeResId) {
		super(context, themeResId);
		this.mContext = context;
		LayoutInflater inflater = getLayoutInflater();
		View view = inflater.inflate(R.layout.dialog_loading, null);
		setContentView(view);
		//初始化控件
		initView(view);
		//设置监听器
		setListener();

	}

	public static LoadingDialog with(Context context) {
		return new LoadingDialog(context);

	}

	private void initView(View view) {
		setCanceledOnTouchOutside(false);  // dialog外不消失
		setCancelable(false); // 返回键不退出
		WindowManager.LayoutParams wmlp = this.getWindow().getAttributes();
		wmlp.gravity = Gravity.CENTER;
	}

	private void setListener() {
	}


}
